#include "EpilFunctionBodyExpressionCode.h"
#include "TCharSupport.h"
#include "EpilOutputHelper.h"
#include "EpilPointerHelper.h"


EpilFunctionBodyExpressionCode::EpilFunctionBodyExpressionCode( const EpilLexLocation & location )
: EpilExpressionCodeBase( location )
, m_chunk( NULL )
, m_parameterList( NULL )
{
}


EpilFunctionBodyExpressionCode::~EpilFunctionBodyExpressionCode()
{
	EpilPointerHelper::SafeDelete( m_parameterList );
	EpilPointerHelper::SafeDelete( m_chunk );
}


tstring EpilFunctionBodyExpressionCode::ToEpilCode( int indent ) const
{
	tstringstream ret;
	ret << t("function ");
	ret << m_parameterList->ToEpilCode();
	ret << endl;
	ret << m_chunk->ToEpilCode( indent + 1 );
	ret << endl;
	ret << EpilOutputHelper::GetIndent( indent );
	ret << t("end");
	return ret.str();
}